#!/usr/bin/python
"""
Add a screening.
"""

import sys
import datetime

from movie.vote.models import Movie
from movie.vote.models import Screening

def AddScreening(movie_name):
  print 'Movie = %s' % (movie_name,)
  m = Movie.objects.get(pk=movie_name)
  s = Screening(movie=m, date=datetime.datetime.now())
  s.save()
  for voter in m.voters.all():
    s.voters.add(voter)
  for downvoter in m.downvoters.all():
    s.downvoters.add(downvoter)
  m.voters.clear()
  m.downvoters.clear()


if __name__ == '__main__':
  AddScreening(sys.argv[1])
